/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Web_service_simulation;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author sabrina
 */
@Entity
@Table(name = "contacts")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Contacts.findAll", query = "SELECT c FROM Contacts c"),
    @NamedQuery(name = "Contacts.findByIdContact", query = "SELECT c FROM Contacts c WHERE c.idContact = :idContact"),
    @NamedQuery(name = "Contacts.findByBookingsCount", query = "SELECT c FROM Contacts c WHERE c.bookingsCount = :bookingsCount"),
    @NamedQuery(name = "Contacts.findByCreatedAt", query = "SELECT c FROM Contacts c WHERE c.createdAt = :createdAt"),
    @NamedQuery(name = "Contacts.findByAddress", query = "SELECT c FROM Contacts c WHERE c.address = :address"),
    @NamedQuery(name = "Contacts.findByAcceptEmailSpam", query = "SELECT c FROM Contacts c WHERE c.acceptEmailSpam = :acceptEmailSpam"),
    @NamedQuery(name = "Contacts.findByExtraAddress", query = "SELECT c FROM Contacts c WHERE c.extraAddress = :extraAddress"),
    @NamedQuery(name = "Contacts.findByCountry", query = "SELECT c FROM Contacts c WHERE c.country = :country"),
    @NamedQuery(name = "Contacts.findByUpdatedAt", query = "SELECT c FROM Contacts c WHERE c.updatedAt = :updatedAt"),
    @NamedQuery(name = "Contacts.findByLastBookingDate", query = "SELECT c FROM Contacts c WHERE c.lastBookingDate = :lastBookingDate"),
    @NamedQuery(name = "Contacts.findByBirthday", query = "SELECT c FROM Contacts c WHERE c.birthday = :birthday"),
    @NamedQuery(name = "Contacts.findByPostcode", query = "SELECT c FROM Contacts c WHERE c.postcode = :postcode"),
    @NamedQuery(name = "Contacts.findByEmailAddress", query = "SELECT c FROM Contacts c WHERE c.emailAddress = :emailAddress"),
    @NamedQuery(name = "Contacts.findByMobilePhone", query = "SELECT c FROM Contacts c WHERE c.mobilePhone = :mobilePhone"),
    @NamedQuery(name = "Contacts.findByFirstname", query = "SELECT c FROM Contacts c WHERE c.firstname = :firstname"),
    @NamedQuery(name = "Contacts.findByCity", query = "SELECT c FROM Contacts c WHERE c.city = :city"),
    @NamedQuery(name = "Contacts.findByTags", query = "SELECT c FROM Contacts c WHERE c.tags = :tags"),
    @NamedQuery(name = "Contacts.findByGender", query = "SELECT c FROM Contacts c WHERE c.gender = :gender"),
    @NamedQuery(name = "Contacts.findByLastname", query = "SELECT c FROM Contacts c WHERE c.lastname = :lastname"),
    @NamedQuery(name = "Contacts.findByAcceptSmsSpam", query = "SELECT c FROM Contacts c WHERE c.acceptSmsSpam = :acceptSmsSpam"),
    @NamedQuery(name = "Contacts.findByFixedPhone", query = "SELECT c FROM Contacts c WHERE c.fixedPhone = :fixedPhone"),
    @NamedQuery(name = "Contacts.findBySociety", query = "SELECT c FROM Contacts c WHERE c.society = :society"),
    @NamedQuery(name = "Contacts.findByNote", query = "SELECT c FROM Contacts c WHERE c.note = :note")})


public class Contacts implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_contact")
    private Integer idContact;
    @Column(name = "bookings_count")
    private Integer bookingsCount;
    @Basic(optional = false)
    @NotNull
    @Column(name = "created_at")
    @Temporal(TemporalType.DATE)
    private Date createdAt;
    @Size(max = 300)
    @Column(name = "address")
    private String address;
    @Column(name = "accept_email_spam")
    private Boolean acceptEmailSpam;
    @Size(max = 300)
    @Column(name = "extra_address")
    private String extraAddress;
    @Size(max = 50)
    @Column(name = "country")
    private String country;
    @Column(name = "updated_at")
    @Temporal(TemporalType.DATE)
    private Date updatedAt;
    @Column(name = "last_booking_date")
    @Temporal(TemporalType.DATE)
    private Date lastBookingDate;
    @Column(name = "birthday")
    @Temporal(TemporalType.DATE)
    private Date birthday;
    @Size(max = 10)
    @Column(name = "postcode")
    private String postcode;
    @Size(max = 50)
    @Column(name = "email_address")
    private String emailAddress;
    @Size(max = 20)
    @Column(name = "mobile_phone")
    private String mobilePhone;
    @Size(max = 30)
    @Column(name = "firstname")
    private String firstname;
    @Size(max = 50)
    @Column(name = "city")
    private String city;
    @Size(max = 20)
    @Column(name = "tags")
    private String tags;
    @Column(name = "gender")
    private Character gender;
    @Size(max = 30)
    @Column(name = "lastname")
    private String lastname;
    @Column(name = "accept_sms_spam")
    private Boolean acceptSmsSpam;
    @Size(max = 20)
    @Column(name = "fixed_phone")
    private String fixedPhone;
    @Size(max = 30)
    @Column(name = "society")
    private String society;
    @Size(max = 300)
    @Column(name = "note")
    private String note;
    @JoinTable(name = "contact_booking", joinColumns = {
        @JoinColumn(name = "id_contact", referencedColumnName = "id_contact")}, inverseJoinColumns = {
        @JoinColumn(name = "id_booking", referencedColumnName = "id_booking")})
    @ManyToMany
    private Collection<Bookings> bookingsCollection;

    public Contacts() {
    }

    public Contacts(Integer idContact) {
        this.idContact = idContact;
    }

    public Contacts(Integer idContact, Date createdAt) {
        this.idContact = idContact;
        this.createdAt = createdAt;
    }

    public Integer getIdContact() {
        return idContact;
    }

    public void setIdContact(Integer idContact) {
        this.idContact = idContact;
    }

    public Integer getBookingsCount() {
        return bookingsCount;
    }

    public void setBookingsCount(Integer bookingsCount) {
        this.bookingsCount = bookingsCount;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Boolean getAcceptEmailSpam() {
        return acceptEmailSpam;
    }

    public void setAcceptEmailSpam(Boolean acceptEmailSpam) {
        this.acceptEmailSpam = acceptEmailSpam;
    }

    public String getExtraAddress() {
        return extraAddress;
    }

    public void setExtraAddress(String extraAddress) {
        this.extraAddress = extraAddress;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Date getLastBookingDate() {
        return lastBookingDate;
    }

    public void setLastBookingDate(Date lastBookingDate) {
        this.lastBookingDate = lastBookingDate;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getPostcode() {
        return postcode;
    }

    public void setPostcode(String postcode) {
        this.postcode = postcode;
    }

    public String getEmailAddress() {
        return emailAddress;
    }

    public void setEmailAddress(String emailAddress) {
        this.emailAddress = emailAddress;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public Character getGender() {
        return gender;
    }

    public void setGender(Character gender) {
        this.gender = gender;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public Boolean getAcceptSmsSpam() {
        return acceptSmsSpam;
    }

    public void setAcceptSmsSpam(Boolean acceptSmsSpam) {
        this.acceptSmsSpam = acceptSmsSpam;
    }

    public String getFixedPhone() {
        return fixedPhone;
    }

    public void setFixedPhone(String fixedPhone) {
        this.fixedPhone = fixedPhone;
    }

    public String getSociety() {
        return society;
    }

    public void setSociety(String society) {
        this.society = society;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    @XmlTransient
    public Collection<Bookings> getBookingsCollection() {
        return bookingsCollection;
    }

    public void setBookingsCollection(Collection<Bookings> bookingsCollection) {
        this.bookingsCollection = bookingsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idContact != null ? idContact.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Contacts)) {
            return false;
        }
        Contacts other = (Contacts) object;
        if ((this.idContact == null && other.idContact != null) || (this.idContact != null && !this.idContact.equals(other.idContact))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Contacts[ idContact=" + idContact + " ]";
    }
    
}
